package lab02.test20;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
//        20、 	编写一个应用程序，用户从键盘输入一行
//         含有数字和字符的字符串，程序仅仅输出字符串中的全部数字字符

        Scanner sc = new Scanner(System.in);
        StringBuffer stringBuffer = new StringBuffer();

        System.out.println("请输入含有数字和字符的字符串：");
        String result = sc.next();

        for (int i = 0; i < result.length(); i++) {
            char temp = result.charAt(i);
            if (temp >= '0' && temp <= '9') {
                stringBuffer.append(temp);
            }
        }
        System.out.println(stringBuffer.toString());
    }
}
